﻿using System;
using ParserGenerator.CharacterMapping;

namespace ParserGenerator.ScannerConstruction
{
    [Serializable]
    public sealed class ScannerAutomatonTransition
    {
        public ScannerAutomatonState State { get; }
        public CharClass Symbol { get; }
        public ScannerAutomatonState Target { get; }

        internal ScannerAutomatonTransition(ScannerAutomatonState state, CharClass symbol, ScannerAutomatonState target)
        {
            if (state == null)
                throw new ArgumentNullException(nameof(state));
            if (target == null)
                throw new ArgumentNullException(nameof(target));
            if (symbol == null)
                throw new ArgumentNullException(nameof(symbol));
            State = state;
            Symbol = symbol;
            Target = target;
        }

        public sealed override string ToString()
        {
            return string.Format("{0}: {1} -> {2}", Symbol.Number, Symbol, Target);
        }
    }
}
